﻿using Entity;
using System.Linq;

namespace DataBaseConnect
{
    /// <summary>
    /// 用户管理仓储实现
    /// </summary>
    public class UserRepository : FonourRepositoryBase<User>, IUserRepository
    {
        public UserRepository(MyDataBase dbcontext) : base(dbcontext)
        {

        }

        /// <summary>
        /// 根据用户名和密码获取用户信息
        /// </summary>
        /// <param name="Name">用户名</param>
        /// <param name="Passowrd">密码</param>
        /// <returns></returns>
        public User GetUser(string Name, string Passowrd)
        {
            return _dbContext.Set<User>().FirstOrDefault(m => m.UserName == Name && m.Password == Passowrd);
        }
    }
}
